package com.icez.domain.model

import android.os.Build
import androidx.annotation.RequiresApi
import com.icez.data.model.Episode
import java.time.Duration
import java.time.OffsetDateTime

data class EpisodeInfo(
    val uri: String = "",
    val title: String = "",
    val subTitle: String = "",
    val summary: String = "",
    val author: String = "",
    val published: OffsetDateTime = OffsetDateTime.MIN,
    val duration: Duration? = null
)

@RequiresApi(Build.VERSION_CODES.O)
fun Episode.asExternalModel(): EpisodeInfo = EpisodeInfo (
    uri = uri,
    title = title,
    subTitle = subtitle ?: "",
    summary = summary ?: "",
    author = author ?: "",
    published = published,
    duration = duration
)